<template>
  <div style="flex:1;" class="flex auto">
    <ul class="nav nav-tabs" style="margin-bottom:10px">
      <li class="active"><a href="#">卡详细信息</a></li>
    </ul>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' @condition-changed='search' v-ref:cri>
        <div novalidate class="form-inline" partial>
          <div class="form-group">
            <button class="btn btn-success width-80" @click="search()" v-el:cx>查询</button>
          </div>
        </div>
      </criteria>
      <data-grid  :model="model" partial='list' v-ref:grid>
        <template partial='head'>
          <tr>
             <th>序号</th>
             <!-- <th>发票编号</th> -->
             <th>用户编号</th>
             <th>表编号</th>
             <th>用户姓名</th>
             <th>发卡人</th>
             <th>卡类型</th>
             <th>状态</th>
             <th>使用日期</th>
          </tr>
        </template>
        <template partial='body':model="model">
          <tr>
            <td style="text-align:center">{{$index+1}}</td>
            <!-- <td style="text-align:center">{{row.f_bill_id}}</td> -->
            <td style="text-align:center">{{row.f_userinfo_id}}</td>
            <td style="text-align:center">{{row.f_user_id}}</td>
            <td style="text-align:center">{{row.f_user_name}}</td>
            <td style="text-align:center">{{row.f_allot_name}}</td>
            <td style="text-align:center">{{row.f_card_type}}</td>
            <td style="text-align:center">{{row.f_card_state}}</td>
            <td style="text-align:center">{{row.f_operate_date}}</td>
          </tr>
        </template>
        <template partial='foot'></template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

<script>
/**
*阶梯水价查询列表
*/
import AppData from '../../../../stores/AppData'
import * as Util from '../../../Util'
import { PagedList } from 'vue-client'

export default {
  data () {
    return {
      isshow: false,
      model: new PagedList('rs/sql/singleTable_OrderBy', 50, {tablename: "'" + this.tablename + "'",
       orderitem: "'" + this.orderitem + "'", items: "'" + this.items + "'"}),
      xiugai: false
    }
  },
  props: {
    row: {},
    condition: {
      type: String
    },
    tablename: {
      type: String,
      default: 't_carddetail'
    },
    orderitem: {
      type: String,
      default: 'id'
    },
    items: {
      type: String,
      default: '*'
    }
  },
  watch: {
    'row' (val) {
      this.model.search(`f_allot_id = ${val.id}`)
    }
  },
  ready () {
    this.model.search(`f_allot_id = ${this.row.id}`)
  },
  methods: {
    search () {
      this.model.search()
    }
  },
  computed: {
    billType () {
      return [{label: '全部', value: ''}, ...AppData.getParam('发票业务类型')]
    },
    operator () {
      return [{label: '全部', value: ''}, ...AppData.getParam('操作人')]
    },
    filiale () {
      return [{label: '全部', value: ''}, ...AppData.getParam('分公司')]
    },
    billStyle () {
      return [{label: '全部', value: ''}, ...AppData.getParam('发票打印类型')]
    }
  }
}
</script>
